﻿using System.Windows.Forms;

namespace QLNXe
{
    public partial class frmLogin : Form
    {
        public frmLogin()
        {
            InitializeComponent();
        }

        private void frmLogin_FormClosed(object sender, FormClosedEventArgs e)
        {
        }

        private void btnCancel_Click(object sender, System.EventArgs e)
        {
            Application.ExitThread();
        }

        private void btnOK_Click(object sender, System.EventArgs e)
        {
            if (ServiceHelper.WebServiceHelper.CheckAuthentication(Constant.WebserviceUrl.CheckAuthenticationUrl,
                                                                   txtUserName.Text, txtPassword.Text))
            {
                Form1 frm = new Form1();
                Form1.user = txtUserName.Text;
                Form1.pass = txtPassword.Text;
                this.Hide();
                frm.ShowDialog();
            }
            else
            {
                frmError frmErr = new frmError();
                frmErr.ShowDialog();
            }
        }
    }
}